package dk.app.resharylogo;

import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.os.Build;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	
		
		AnimationSet as = new AnimationSet(true);
		
	/*	
		ImageView blue_left = (ImageView) findViewById(R.id.blue_circle);
		
		TranslateAnimation moveRightToLeft = new TranslateAnimation(0, -115, 0, 0);
		moveRightToLeft.setDuration(1000);
		moveRightToLeft.setFillAfter(true);
		as.addAnimation(moveRightToLeft);
		blue_left.startAnimation(moveRightToLeft);
	    
	    ImageView orange_right = (ImageView) findViewById(R.id.orange_circle);
		TranslateAnimation moveLefttoRight = new TranslateAnimation(0, 135, 0, 0);
	    moveLefttoRight.setDuration(1000);
	    moveLefttoRight.setFillAfter(true);
	    as.addAnimation(moveLefttoRight);
	    orange_right.startAnimation(moveLefttoRight);*/
	    
	    
	    ///////////////////////////////////////////////////////////
	    
	    
	    
	    RotateAnimation anim_right = new RotateAnimation(350f,0f,0f,0f);
	    anim_right.setInterpolator(new LinearInterpolator());
	    anim_right.setRepeatCount(Animation.INFINITE);
	    anim_right.setDuration(700);
	    anim_right.setStartOffset(1000);
	    as.addAnimation(anim_right);
	    // Start animating the image
	    final ImageView right_img = (ImageView) findViewById(R.id.orange_circle);
	    right_img.startAnimation(anim_right);
	    /*
	    RotateAnimation anim_left = new RotateAnimation(0, 360, blue_left.getWidth()/2, blue_left.getHeight()/2);
	    anim_left.setInterpolator(new LinearInterpolator());
	    anim_left.setRepeatCount(Animation.INFINITE);
	    anim_left.setDuration(700);
	    anim_left.setStartOffset(2000);
	    as.addAnimation(anim_left);
	    // Start animating the image
	    final ImageView left_img = (ImageView) findViewById(R.id.blue_circle);
	    left_img.startAnimation(anim_left);*/

	    // Later.. stop the animation
	    //splash.setAnimation(null);
	    
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

	/**
	 * A placeholder fragment containing a simple view.
	 */
	public static class PlaceholderFragment extends Fragment {

		public PlaceholderFragment() {
		}

		@Override
		public View onCreateView(LayoutInflater inflater, ViewGroup container,
				Bundle savedInstanceState) {
			View rootView = inflater.inflate(R.layout.fragment_main, container,
					false);
			return rootView;
		}
	}

}
